.container {
  height: 200px;
  perspective: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid black;
  animation: origin 5s infinite;
}
.box {
  padding: 50px;
  width: 100px;
  height: 100px;
  background-color: lightcoral;
  transform: rotateX(45deg);
}

@keyframes origin {
  50% {
    perspective-origin: 1px 50%;
  }
}